<?php 
class candidatesAction extends AdminMaster{
	public function preExecute(){
		
		$this->formFilter['filter_resource_id'] = '-1';
		$this->formFilter['filter_gender_id'] = '-2';
		$this->formFilter['filter_birthday_from'] = '0';
		$this->formFilter['filter_birthday_to'] = '0';
		$this->formFilter['filter_working_status'] = '-2';
		$this->formFilter['filter_total_experience_year'] = '';
		$this->formFilter['filter_major_id'] = '-1';
		$this->formFilter['filter_level_id'] = '-1';
		$this->formFilter['filter_foreign_language_id'] = '-1';
		$this->formFilter['filter_information_technology_id'] = '-1';
		#$this->formFilter['filter_level_ids'] = array();
		#$this->formFilter['filter_major_ids'] = array();
		#$this->formFilter['filter_location_city_ids'] = array();
		
		$this->formFilter['filter_salary_from'] = '0';
		$this->formFilter['filter_salary_to'] = '0';
		$this->formFilter['filter_search_method_id'] = '0';
		
		$this->formFilter['filter_created_from'] = '';
		$this->formFilter['filter_created_to'] = '';
		$this->formFilter['filter_updated_from'] = '';
		$this->formFilter['filter_updated_to'] = '';
		
		$this->data['filter_level_id']				= MasterEducationLevelsTable::getDataList(null);
		
		//echo '<pre>';print_r($this->data['filter_level_id']);die;
		$this->data['filter_foreign_language_id']					= MasterForeignLanguagesTable::getDataList(null, null);
		$this->data['filter_information_technology_id']		= MasterInformationTechnologiesTable::getDataList(null, null);
		$this->data['filter_major_id']										= MasterMajorCatesTable::getDataRecursive();
		$this->data['filter_resource_id']									= CandidateResources::getArrayAllKeyId();
		$this->data['filter_location_city_id']						= LocationCitiesTable::getDataList();
		
		parent::preExecute();
	}
	public function execute($request){
		#$this->data['register_date']	= $request->getParameter('register_date', DateHelper::dateFormat(date('Y-m-d', time())));
		
		$this->data['navigation']	= __('module_candidates',null,'menu').' › '. __('module_candidates_action_candidates',null,'menu');
		$this->formData				= $request->getParameter('Candidates');	//get form data from add new || edit page
		
		$this->data['candidate_documents']		= $request->getParameter('documents', array());
		$this->data['candidate_photos']		= $request->getParameter('candidate_photos', array());
		$this->data['is_default']			= $request->getParameter('is_default', '0');
		
		$this->data['child']['educations']	= $request->getParameter('educations', array());
		$this->data['child']['education_levels']	= MasterEducationLevels::getArrayAllKeyId();
		
		$this->data['child']['workings']	= $request->getParameter('workings', array());
		$this->data['child']['position']	= CompanyPersonContactPositions::getArrayAllKeyId();
		$this->data['child']['job_position']	= JobPositions::getArrayAllKeyId();
		
		$this->data['child']['majors']		= $request->getParameter('majors', array());
		$this->data['child']['major_json']	= MasterMajorsTable::getDataListForJSon();
		
		$this->data['child']['languages']		= $request->getParameter('languages', array());
		$this->data['child']['language_list']	= MasterForeignLanguages::getArrayAllKeyId();
		
		$this->data['child']['information_technologies']		= $request->getParameter('technologies', array());
		$this->data['child']['information_technology_list']	= MasterInformationTechnologies::getArrayAllKeyId();
		$this->data['child']['information_technology_level_list']	= MasterInformationTechnologyLevels::getArrayAllKeyId();
		
		$this->data['child']['skill']				= $request->getParameter('skills', array());
		
		$this->data['child']['job_hope']		= $request->getParameter('job_hopes', array());
		
		$this->data['child']['remark_more']		= $request->getParameter('remark_more', array());
		
		$this->data['cities']= $request->getParameter('cities', array());
		
		//echo '<pre>'; print_r($this->data['child']);die;
		switch ($this->data['action']){
			case ADMIN_DEFINED::DELETE_RECORD:
				$this->data['sec']	= $request->getParameter('sec', '');
				if(empty($this->data['sec'])){
					$this->delRecord();
				}else{
					$this->cancel();
				}
				break;
			case ADMIN_DEFINED::DISABLE:
				$this->disableRecord();
				break;
			case ADMIN_DEFINED::ENABLE:
				$this->enableRecord();
				break;
			case ADMIN_DEFINED::ADD_RECORD:
				//$this->redirect('/admin/vi/faqs/cates');die;
				$this->addRecord();
				break;
			case ADMIN_DEFINED::EDIT_RECORD:
				//$this->redirect('/admin/vi/faqs/cates');die;
				$this->editRecord();
				break;
			case ADMIN_DEFINED::SAVE_ORDER:
				$this->saveOrder();
				break;
			#MORE ACTION HERE
			default:
				$this->filterList();
				break;
		}

		$this->setVar('data', $this->data);
	}
	private function preview($candidate_id){
		$candidate = CandidatesTable::getDataById($candidate_id);
		
		if(count($candidate) > 0){
			$this->data['id']	= $candidate_id;
			$this->data['candidate']	= $candidate;
			$this->data['majors']		= MasterMajors::getArrayAllKeyId();
			$this->data['levels']		= MasterEducationLevels::getArrayAllKeyId();
			$this->data['positions']	= CompanyPersonContactPositions::getArrayAllKeyId();
			$this->data['languages']	= MasterForeignLanguages::getArrayAllKeyId();
			$this->data['language_levels']	= MasterForeignLanguageLevels::getArrayAllKeyId();
			$this->data['technologies']	= MasterInformationTechnologies::getArrayAllKeyId();
			$this->data['technology_levels'] = MasterInformationTechnologyLevels::getArrayAllKeyId();
			$this->data['salaries']			= MasterSalaries::getArrayAllKeyId();
			
			$ran =UserStringHelper::random(6, true);
			$this->getUser()->setFlash('sec', $ran);
			$this->data['sec']	= md5($ran);
			
			$this->setTemplate('preview');
		}else{
			die (__('hacking_attemp',null,'table_list'));
		}
	}
	private function filterList(){
		$this->setAction();
		$this->data['navigation'].=' › '. __('nav_list',null,'table_list');
		
		$this->data['list']['salaries']	= MasterSalaries::getArrayAllKeyId();
		$this->data['list']['candidates']	= Candidates::getDataList($this->data['filter'], $this->data['pagination']);
		
		$this->data['pagination']['total']		= Candidates::getDataListCount($this->data['filter']);
		$this->data['pagination']['router']		= 'candidate_candidates';
		$this->data['pagination']['params']		= $this->data['filter'];
		$pag = new PaginationHelper2($this->data['pagination']);
		$this->data['pagination_pager']	= $pag->getPaginations();
		if($this->data['filter']['filter_key'] == '*'){
			$this->data['filter']['filter_key'] = '';
		}
	}
	private function cancel(){
		$sec = $this->getUser()->getFlash('sec', '');
		if(($this->data['sec']) == md5 ($sec)){
			CandidatesTable::delete(array($this->data['id']));
		}
		$this->redirect($this->generateUrl('candidate_candidates',array('action_name' => ADMIN_DEFINED::ADD_RECORD)));
		
	}
	private function delRecord(){
		CandidatesTable::delete($this->data['select_list']);
		$this->filterList();
	}
	private function disableRecord(){
		CandidatesTable::disable($this->data['select_list']);
		$this->filterList();
	}
	private function enableRecord(){
		CandidatesTable::enable($this->data['select_list']);
		$this->filterList();
	}
	private function saveOrder(){
		$sortData = array();
		for($i = 0; $i< count($this->data['ids']); $i++){
			$sortData[$this->data['ids'][$i]] = $this->data['sort_orders'][$i];
		}
		Candidates::saveSortOrder($sortData);
		$this->filterList();
	}
	/*********************************************************************************
	*
	* ADD NEW
	* 
	**********************************************************************************/
	private function addRecord(){
		$this->data['navigation'].=' › '. __('nav_add_new',null,'table_list');
		$this->data['button_action'] = __('button_add',null,'table_list');
		$this->setTemplate('candidatesForm');
		
		$this->data['list']['cities']		= LocationCitiesTable::getDataList();
		
		$form = new CandidatesFForm();
		if($this->data['is_post']){
			$form->bind($this->formData);
			if($form->isValid()){
				$candidate_id = CandidatesTable::insert($this->formData);
				if($candidate_id > 0){
					
					$this->addPhotos($candidate_id);
					$this->addDocuments($candidate_id);
					$this->addWorking($candidate_id);
					$this->addMajor($candidate_id);
					$this->addCity($candidate_id);
					$this->addEducation($candidate_id);
					$this->addLanguage($candidate_id);
					$this->addInformationTechnology($candidate_id);
					$this->addSkill($candidate_id);
					$this->addJobHope($candidate_id);
					$this->addRemarkMore($candidate_id);
					
					$this->data['result']	= __('add_new_success', null, 'candidate_candidates');
						
					$form = new CandidatesFForm();
					$this->data['candidate_documents'] 	= array();
					$this->data['candidate_photos'] 	= array();
					$this->data['child']['workings']	= array();
					$this->data['child']['skill']	= array();
					$this->data['child']['job_hope']	= array();
					$this->data['child']['remark_more']	= array();
					$this->data['child']['educations']	= array();
					
					$this->data['child']['majors']		= array();
					$this->data['cities']				= array();
					$this->data['child']['languages']	= array();
					$this->data['child']['information_technologies']	= array();
					
					$this->preview($candidate_id);
				}else{
					$this->data['result']	= sprintf(__('add_new_error', null, 'table_list'), sfConfig::get('app_email_admin')) ;
				}
			}
		}
		$arrProPhoto = array();
		foreach($this->data['candidate_photos'] as $val){
			$arrProPhoto[] = array(
					'photo_url'		=> $val,
					'is_default'	=> $val==$this->data['is_default']? 1:0
			);
		}
		$this->data['candidate_photos'] = $arrProPhoto;
		
		$arrTmp = array();
		foreach($this->data['cities'] as $val){
			$arrTmp[$val] = 'checked';
		}
		$this->data['cities']	= $arrTmp;
		
		$this->setVar('form', $form);
	}
	
	/*
	 * EDIT
	*/
	private function editRecord(){
		$this->data['navigation'].=' › '. __('nav_edit',null,'table_list');
		$this->data['action'].='&id='.$this->data['id'];
		$this->data['button_action'] = __('button_edit',null,'table_list');
		$this->setTemplate('candidatesForm');
		
		$this->data['list']['cities']		= LocationCitiesTable::getDataList();
		
		$form = new CandidatesFForm();
		if($this->data['is_post']){
			$form->bind($this->formData);
	/*	$errors = array(); 
  foreach ($form->getErrorSchema() as $key => $err) {  
    if ($key) {  
      $errors[$key] = $err->getMessage();  
    }  
  } print_r($errors);
die;*/
			if($form->isValid()){
				$this->formData['id'] = $this->data['id'];
				
				if(CandidatesTable::update($this->formData)){
					
					$this->addPhotos($this->data['id']);
					$this->addDocuments($this->data['id']);
					$this->addWorking($this->data['id']);
					$this->addMajor($this->data['id']);
					$this->addCity($this->data['id']);
					$this->addEducation($this->data['id']);
					$this->addLanguage($this->data['id']);
					$this->addInformationTechnology($this->data['id']);
					$this->addSkill($this->data['id']); 
					$this->addJobHope($this->data['id']);
					$this->addRemarkMore($this->data['id']);
					
					$this->data['result']	= __('edit_success', null, 'candidate_candidates');
						
					$this->data['child']['workings'] = array();
					$this->data['child']['workings'] = CandidateWorkingHistoriesTable::getDataList(array('filter_enabled' => '1', 'filter_candidate_id'=>$this->data['id']));
					
					
					$this->data['child']['skill'] = array();
					$this->data['child']['skill'] = CandidateOtherSkillesTable::getListByCandidateId($this->data['id']);
						
					$this->data['child']['job_hope'] = array();
					$this->data['child']['job_hope'] = CandidateJobHopesTable::getListByCandidateId($this->data['id']);
						
					$this->data['child']['remark_more'] = array();
					$this->data['child']['remark_more'] = CandidateRemarksTable::getListByCandidateId($this->data['id']);
						
					
					$this->data['child']['educations'] = array();
					$this->data['child']['educations'] = CandidateEducationsTable::getDataList(array('filter_candidate_id'=>$this->data['id']));
										
					$this->data['child']['majors'] = array();
					$this->data['child']['majors'] = CandidateToMajorsTable::getListByCandidateId($this->data['id']);
					
					$this->data['child']['languages'] = array();
					$this->data['child']['languages'] = CandidateToForeignLanguagesTable::getListByCandidateId($this->data['id']);
					
					
					$this->data['child']['information_technologies'] = array();
					$this->data['child']['information_technologies'] = CandidateToInformationTechnologiesTable::getListByCandidateId($this->data['id']);
					
				}else{
					$this->data['result']	= sprintf(__('edit_error', null, 'table_list'), sfConfig::get('app_email_admin')) ;
				}
				$arrTmp = array();
				foreach($this->data['cities'] as $val){
					$arrTmp[$val] = 'checked';
				}
				$this->data['cities']	= $arrTmp;
			}
			$arrProPhoto = array();
			foreach($this->data['candidate_photos'] as $val){
				$arrProPhoto[] = array(
						'photo_url'			=> $val,
						'is_default'		=> $val==$this->data['is_default']?1:0
				);
			}
			$this->data['candidate_photos'] = $arrProPhoto;
		}else{
			$data = CandidatesTable::getDataByIdAdmin($this->data['id']);
			if(count($data)<0){
				$this->redirect($this->data['redirect']);
			}else{
				$this->formData = array(
						'resource_id'		=> $data['resource_id'],
						'full_name'			=> $data['full_name'],
						'email'				=> $data['email'],
						'address'			=> $data['address'],
						'date_of_birth' 	=> DateHelper::dateFormatFree($data['date_of_birth'],'d-m-Y'),
						'gender' 			=> $data['gender'],
						'phone_number' 				=> $data['phone_number'],
						'working_status' 			=> $data['working_status'],
						'work_kind' 				=> $data['work_kind'],
						'salary_require' 			=> $data['salary_require'],
						
						'is_married'					=> $data['is_married'],
						'is_japan_training'		=> $data['is_japan_training'],
						'home_address'				=> $data['home_address'],
						'contact_address'			=> $data['contact_address'],
						'telephone'					=> $data['telephone'],
						'otherphone'				=> $data['otherphone'],
						'salary_id'					=> $data['salary_id'],
						'remark'						=> $data['remark'],
						'register_date'			=> DateHelper::dateFormat($data['register_date']),
						#'job_hope'					=> $data['job_hope'],
						'working_experience_foreign'				=> $data['working_experience_foreign'],
						
						'more_skill'					=> $data['more_skill'],
						'more_skill_description'		=> $data['more_skill_description'],
						
						
						'identity_card' 		=> $data['identity_card'],
						'education' 			=> $data['education'],
						'total_experience_year' => $data['total_experience_year'],
						
						'location_city_id'			=> $data['location_city_id'],
						'location_district_id'		=> $data['location_district_id'],
						'home_city_id'			=> $data['home_city_id'],
						'home_district_id'		=> $data['home_district_id'],
						
						'is_enabled'		=> $data['is_enabled'],
						'_csrf_token'=> $form->getCSRFToken()
				);
				#$this->data['register_date'] = DateHelper::dateFormat($data['created_at']);
				
				$form->bind($this->formData);
				$this->data['candidate_photos'] = CandidatePhotosTable::getListByCandidateId($this->data['id']);
				
				
				$this->data['child']['workings'] = array();
				$this->data['child']['workings'] = CandidateWorkingHistoriesTable::getDataList(array('filter_enabled' => '1', 'filter_candidate_id'=>$this->data['id']));
				
				
				$this->data['child']['educations'] = array();
				$this->data['child']['educations'] = CandidateEducationsTable::getDataList(array('filter_candidate_id'=>$this->data['id']));
				
				$this->data['child']['skill'] = array();
				$this->data['child']['skill'] = CandidateOtherSkillesTable::getListByCandidateId($this->data['id']);
					
				$this->data['child']['job_hope'] = array();
				$this->data['child']['job_hope'] = CandidateJobHopesTable::getListByCandidateId($this->data['id']);
				
				$this->data['child']['remark_more'] = array();
				$this->data['child']['remark_more'] = CandidateRemarksTable::getListByCandidateId($this->data['id']);
				
				$this->data['child']['majors'] = array();
				$this->data['child']['majors'] = CandidateToMajorsTable::getListByCandidateId($this->data['id']);
				
				
				$this->data['cities'] = CandidateToLocationCitiesTable::getListByCandidateId($this->data['id']);
				$arrTmp = array();
				foreach($this->data['cities'] as $val){
					$arrTmp[$val['location_city_id']] = 'checked';
				}
				$this->data['cities'] = $arrTmp;
				
				$this->data['child']['languages'] = array();
				$this->data['child']['languages'] = CandidateToForeignLanguagesTable::getListByCandidateId($this->data['id']);
				
				
				$this->data['child']['information_technologies'] = array();
				$this->data['child']['information_technologies'] = CandidateToInformationTechnologiesTable::getListByCandidateId($this->data['id']);
				
				$this->data['candidate_documents'] = CandidateDocumentsTable::getListByCandidateId($this->data['id']);
				$arr = array();
				foreach($this->data['candidate_documents'] as $tmp){
					$arr[] = $tmp['document_url'];
				}
				$this->data['candidate_documents'] = $arr;
				
			}
		}
	
		$this->setVar('form', $form);
		
	}
	#ACTION FOR EACH ROW
	private function setAction(){
		$action = array();
		$action[]=array(
				'href'	=>	'?action_name='.ADMIN_DEFINED::EDIT_RECORD.'&id=%s',
				'text'	=>	__('action_edit',null,'table_list'),
				'title' =>	__('action_edit',null,'table_list'),
		);
	
		$this->data['action_list']	= $action;
	}
	
	##############################
	private function addDocuments($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateDocumentsTable::deletePhotoByCandidateId($candidate_id);
		foreach($this->data['candidate_documents'] as $val){
			$ptData = array(
					'candidate_id'		=> $candidate_id,
					'document_url'		=> $val,
					'file_name'			=> basename($val)
			);
			CandidateDocumentsTable::insert($ptData);
		}
	}
	private function addPhotos($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidatePhotosTable::deletePhotoByCandidateId($candidate_id);
		foreach($this->data['candidate_photos'] as $val){
			$ptData = array(
					'candidate_id'		=> $candidate_id,
					'photo_url'			=> $val,
					'is_default'		=> $val==$this->data['is_default']?1:0
			);
			CandidatePhotosTable::insert($ptData);
		}
	}
	
	private function addLanguage($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateToForeignLanguagesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['languages'] as $work){
			if(intval($work['language_id']) <= 0 || intval($work['language_level_id']) <= 0) continue;
			CandidateToForeignLanguagesTable::insert(array(
				'candidate_id'								=> $candidate_id,
				'foreign_language_id'					=> $work['language_id'],
				'foreign_language_level_id'		=> $work['language_level_id'],
				'description'									=> strval($work['description']),
				'is_checked'									=> intval($work['is_checked'])
			));
			
		}
	}
	private function addInformationTechnology($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateToInformationTechnologiesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['information_technologies'] as $work){
			if(intval($work['technology_id']) <= 0 || intval($work['technology_level_id']) <= 0) continue;
			CandidateToInformationTechnologiesTable::insert(array(
				'candidate_id'											=> $candidate_id,
				'information_technology_id'					=> $work['technology_id'],
				'information_technology_level_id'		=> $work['technology_level_id'],
				'description'												=> $work['description'],
				'is_checked'												=> intval($work['is_checked'])
			));
			
		}
	}
	private function addCity($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
	
		CandidateToLocationCitiesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['cities'] as $val){
			$ptData = array(
					'candidate_id'		=> $candidate_id,
					'location_city_id'	=> $val
			);
			CandidateToLocationCitiesTable::insert($ptData);
	
		}
	}
	private function addMajor($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateToMajorsTable::deleteByCandidateId($candidate_id);
		foreach( $this->data['child']['majors'] as $work){
			if(intval($work['major_id']) <= 0 || intval($work['year_experience']) < 0 ) continue;
			CandidateToMajorsTable::insert(array(
				'candidate_id'			=> $candidate_id,
				'major_id'					=> $work['major_id'],
				'year_experience'		=> $work['year_experience'],
				'description'				=> strval($work['description'])
			));
			
		}
	}
	private function addJobHope($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateJobHopesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['job_hope'] as $work){
			if(empty($work['job_hope'])) continue;
			CandidateJobHopesTable::insert(array(
			'candidate_id'			=> $candidate_id,
			'job_hope'					=> $work['job_hope'],
			'description'				=> $work['description']
			));
				
		}
	}
	private function addRemarkMore($candidate_id = 0){ 
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateRemarksTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['remark_more'] as $work){
			if(empty($work['remarked_at'])) continue;	
			CandidateRemarksTable::insert(array(
				'candidate_id'			=> $candidate_id,
				'remarked_at'				=> $work['remarked_at'],
				'content'					=> $work['content']
			));
			
		}
	}
	private function addSkill($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateOtherSkillesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['skill'] as $work){
			if(empty($work['name'])) continue;
			CandidateOtherSkillesTable::insert(array(
			'candidate_id'			=> $candidate_id,
			'skill'							=> $work['name'],
			'description'				=> $work['description'],
			'is_checked'				=> intval($work['is_checked'])
			));
				
		}
	}
	private function addEducation($candidate_id = 0){
		//print_r($this->data['child']['educations']);die;
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		
		CandidateEducationsTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['educations'] as $val){
			if(intval($val['education_level_id']) <=0 || empty($val['date_from']) || empty($val['date_to']) || empty($val['education_school']) || empty($val['major_subject'])) continue;
			CandidateEducationsTable::insert(array(
				'candidate_id'			=> $candidate_id,
				'date_from'					=> $val['date_from'],
				'date_to'						=> $val['date_to'],
				'education_school'	=> $val['education_school'],
				'major_subject'			=> $val['major_subject'],
				'education_level_id'=> $val['education_level_id'],
				'is_checked'				=> intval($val['is_checked'])
				));
		}
	
	}
	
	private function addWorking($candidate_id = 0){
		$candidate_id = intval($candidate_id);
		if($candidate_id <=0){
			return;
		}
		CandidateWorkingHistoriesTable::deleteByCandidateId($candidate_id);
		foreach($this->data['child']['workings'] as $work){
			if(intval($work['position_id']) <= 0 || intval($work['job_position_id']) <= 0 || empty ($work['date_from']) || empty($work['date_to']) || empty($work['company_name'])) continue;
			CandidateWorkingHistoriesTable::insert(array(
				'candidate_id'			=> $candidate_id,
				'job_position_id'		=> $work['job_position_id'],
				'position_id'				=> $work['position_id'],
				'date_from'					=> $work['date_from'],
				'date_to'						=> $work['date_to'],
				'company_name'			=> $work['company_name'],
				'work_description'	=> $work['description'],
				'confirm_person'		=> $work['confirm_person'],
				'confirm_phone_number'	=> $work['confirm_phone_number'],
				'confirm_description'	=> $work['confirm_description'],
				'is_confirmed'				=> intval($work['is_confirmed'])
			));
			
		}
	}
	
}
